<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.hs.*,com.hs.pre.sys.validate.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String title = Environment.getValue(Environment.PROP_APP_TITLE);
request.setCharacterEncoding("utf-8");

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<base href="<%=basePath%>">
<TITLE><%= title%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="<%= title%>" name=keywords>
<META content="<%= title%>" name=description>
<LINK href="<%=path %>/app/css/search.css" type=text/css rel=stylesheet>
<SCRIPT src="<%=path %>/app/js/sort.js" type=text/javascript></SCRIPT>
<SCRIPT src="<%=path %>/app/js/search.js" type=text/javascript></SCRIPT>
<SCRIPT src="<%=path %>/dwr/engine.js" type=text/javascript></SCRIPT>
<SCRIPT src="<%=path %>/dwr/interface/preSort.js" type=text/javascript></SCRIPT>
<SCRIPT src="<%=path %>/app/js/common.js" type=text/javascript></SCRIPT>
<SCRIPT>
var LIFESTYLE_trendsAttr = {};
var LIFESTYLE_hdf = {};
var LIFESTYLE_onLoadFunctions = [];
var GEvent;
function simpleSearch(){
	 var q=document.qForm.qtemp.value;
	 if(q==''){
	   alert("请输入搜索词！");
	   return false;
	 }else{
	   var cat = document.form1.itemtype.value; 
	   if(cat=="whole"){
	   		wholeSearch();
	   }else{
	   		q = q.replace(/ /g," AND "+cat+":");
	   		document.qForm.q.value=cat+':'+q; 
	   		qForm.submit(); 
	   } 
	 }
}

//全文搜索
function wholeSearch(){
 		var q=document.qForm.qtemp.value;
	 	var qStr="";
	 	var concat="";
	 	var types=new Array("fangm","yaowzc","zuz","gongx","chufly");
	 	for(var i=0;i<types.length;i++){
	 		qStr+=concat+makeQ(q,types[i]);
	 		concat=" OR ";
	 	}	 
	 	//alert(qStr);
	   document.qForm.q.value=qStr; 
	   qForm.submit();  		 	
}

function makeQ(q,cat){
		q = q.replace(/ /g," AND "+cat+":");
	 	q = cat+":"+q;
	 	return q;
}

function testDwr() {
  preSort.getPreSortInfo(function(data) {
    alert(data);
  });
}

/******单击分类进行搜索********/
function submitS(qtemp)
{
	document.qForm.qtemp.value = qtemp;
	simpleSearch();
}
/******更多*****/
function moresort(psortId)
{
  document.formSort.itemtype.value = document.form1.itemtype.value;
  document.formSort.sortPId.value = psortId;
  formSort.submit();  
}
</SCRIPT>
<META content="MSHTML 6.00.2900.3268" name=GENERATOR></HEAD>
<BODY text=#000000 vLink=#551a8b aLink=#ff0000 link=#0000cc bgColor=#ffffff>
<%@ include file="../tablehead.jsp"%>
<IMG style="MARGIN-TOP: 20px; MARGIN-BOTTOM: 20px" height=110 alt="" src="<%=path%>/app/images/logo1.gif" width=274>
<FORM name=qForm method="post" onSubmit="return simpleSearch();" action="<%=path %>/app/pre/search.do" >
<TABLE style="MARGIN-BOTTOM: 12px" cellSpacing=0 cellPadding=0 border=0>
  <TBODY>
  <TR>
    <TD style="FONT-SIZE: 72%; COLOR: #a8a8a8" noWrap colSpan=3>示例: 大黄 或 桂枝汤 
    </TD></TR>
  <TR vAlign=bottom>
    <TD style="PADDING-BOTTOM: 2px; PADDING-TOP: 5px">
      <INPUT name="qtemp" maxLength=2048 size=60>  
	  <input name="version" type="hidden" value="2.2" />
	  <input name="start" type="hidden" value="0" />
	  <input name="rows" type="hidden" value="10" /> 
	  <input name="echoParams" type="hidden" value="ALL" />
	  <input name="field" type="hidden" value="fangm" />
	  <input name="q" type="hidden" value="" />
     </TD>
    <TD width=6>&nbsp;</TD>
    <TD width=100><INPUT id=button_search style="FONT-SIZE: 95%"  type=submit value="方泉搜索">&nbsp;</TD>
    <TD width=100> <INPUT id=button_search style="FONT-SIZE: 95%" type=button onClick="advSearch();" value="高级搜索"></TD>
    </TR>
    <TR>
    <TD vAlign=top  >
	      <TABLE style="FONT-SIZE: 75%" cellSpacing=0 cellPadding=5 width="100%" border=0>
	        <TBODY>
	        <TR align=middle>
	          <TD class=SubTabOn id=td_whole noWrap><A 
	            href="javaScript:changeItemType('whole','td_whole')">全文检索</A></TD>
	          <TD class=SubTab id=td_fm noWrap><A 
	            href="javaScript:changeItemType('fangm','td_fm')">方剂名称</A></TD>
	          <TD class=SubTab id=td_yw noWrap><A 
	            href="javaScript:changeItemType('yaowzc','td_yw')">药物</A></TD>
	          <TD class=SubTab id=td_zz noWrap><A 
	            href="javaScript:changeItemType('zuz','td_zz')">主治</A></TD>
	          <TD class=SubTab id=td_gx noWrap>
	          <A href="javaScript:changeItemType('gongx','td_gx')">功效</A></TD> 
	          <TD class=SubTab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
	          <TD class=SubTab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR>  
	        </TBODY>
	        </TABLE>
    </TD>
  </TR> 
</TBODY>
</TABLE> 
</FORM>
<form name="formSort" method="post" action="/pre/sortAc.do"  >
<input type="hidden"  name="sortDis" value="moresort" />
<input type="hidden"  name="itemtype" />
<input type="hidden"  name="sortPId" value=""/>
</form>
<form name="form1">
<input type="hidden" value="whole" name="itemtype"/>
</form>
<DIV><FONT size=-1>搜索80000多个方剂信息</FONT></DIV><BR>
<div id="schBanner" style="display:none">
			<!-- 请组合查询条件：
	      <input id="cb1"  type="checkbox" name="tt" value='fangm' onClick="showBanner('fangmBanner');"  />方剂名称
	      <input id="cb2"  type="checkbox" name="tt" value='yaowzc' onClick="showBanner('yaowzcBanner');"  />药物组成
	      <input id="cb3"  type="checkbox" name="tt" value='zuz' onClick="showBanner('zuzBanner');"  />主治
	      <input id="cb4"  type="checkbox" name="tt" value='gongx' onClick="showBanner('gongxBanner');" />功效
		  <input id="cb5"  type="checkbox" name="tt" value='chufly' onClick="showBanner('chuflyBanner');"  />处方来源-->
		  <form name="cqueryForm" method="post" action="<%=path %>/app/pre/search.do">
		   <TABLE style="FONT-SIZE: 80%" cellSpacing=6 cellPadding=0 border=0>
             <TBODY>
             <tr>
             <td> 
           		方剂名称
             </td>
           	<td>
           		<input name="fangmtext" type="text" size="60"/>&nbsp;
            </td> 
            </tr>
            <tr>
			<td>
		  		药物组成
		  	</td>
		  	<td>
		  	    <input name="yaowzctext" type="text" size="60"/>&nbsp;</td>
		  	    </tr>
		    <tr>
			 <td>
		       主&nbsp;&nbsp;&nbsp;&nbsp; 治</td>
		       <td><input name="zuztext" type="text" size="60"/> </td></tr>
			 <tr>
			 <td>
				功&nbsp;&nbsp;&nbsp;&nbsp;效：</td>
				<td><input name="gongxtext" type="text" size="60" /> </td></tr>
			<tr>	 
			 <td>
				处方来源：</td><td><input name="chuflytext" type="text" size="60"/> </td></tr>
				<tr>	 
			 <td colspan=2 align="right">
				<input type="button"  value="提交高级搜索" onClick="makeSch();" /></td></tr>
				  <input type="hidden" name="q" value=""/>
				  <input name="version" type="hidden" value="2.2"/>
				  <input name="start" type="hidden" value="0" />
				  <input name="rows" type="hidden" value="10" />
				  <input name="echoParams" type="hidden" value="ALL" />
				 </TBODY>
			</TABLE>
		</FORM>
</div>
        
<DIV class=csmf style="MARGIN-BOTTOM: 20px; TEXT-ALIGN: center"></DIV>
<DIV id=location_option 
style="FONT-SIZE: 72%; MARGIN-BOTTOM: 6px; PADDING-BOTTOM: 3px; WIDTH: 42em; COLOR: #6f6f6f; BORDER-BOTTOM: #c9d7f1 1px solid">
</DIV>
<SPAN id=city_list 
style="BORDER-RIGHT: #3366cc 1px solid; PADDING-RIGHT: 6px; BORDER-TOP: #c9d7f1 1px solid; DISPLAY: none; PADDING-LEFT: 6px; Z-INDEX: 100; BACKGROUND: #ffffff; PADDING-BOTTOM: 6px; BORDER-LEFT: #a2bae7 1px solid; PADDING-TOP: 6px; BORDER-BOTTOM: #3366cc 1px solid; POSITION: absolute">
</SPAN>
<DIV>
<table id="sortObj" noWrap style="FONT-SIZE: 82%" cellSpacing=0 cellPadding=0 width="1%" border=0>
</table>
<DIV 
style="BORDER-TOP: rgb(201,215,241) 1px solid; MARGIN-TOP: 6px; FONT-SIZE: 72%; WIDTH: 42em"></DIV><BR><BR>
<CENTER></CENTER>
 </DIV>
 </BODY></HTML>
<script type="text/javascript">
<!--
function loadSort(){
  sort.getSortSearch(function(data) {
  if(data == null)
   return ;
   var size = data.length;
   var tObj = document.getElementById("sortObj");
   for(var i=0 ; i<size; i++){
      
      var oTr= tObj.insertRow();
	  var oTd= oTr.insertCell();
	  oTr.width=100;
	  var cv= '  <table noWrap cellPadding=0 border=0><tr><td  vAlign=top>'+
	  '<table style="FONT-SIZE: 100%" cellSpacing=6 cellPadding=0 border=00>'+
		'<tr><td>'+data[i].sortName+':</td></tr></table></td><td>'+
	     ' <table style="FONT-SIZE: 100%" cellSpacing=6 cellPadding=0 border=0>'+
	     '<tr id="so_'+data[i].sortId+'" ></tr></table></td></tr></table>';
	     
	 var htmcon='<TD vAlign=top noWrap width="10%">'+
	 '<TABLE style="FONT-SIZE: 100%" cellSpacing=6 cellPadding=0 border=0><TR>'+
			  '<TD noWrap >'+data[i].sortName+':</TD></TR></TABLE></TD><TD vAlign=top>'+
		      '<TABLE noWrap style="FONT-SIZE: 100%" cellSpacing=6 cellPadding=0 border=0 ><tr noWrap id="so_'+data[i].sortId+'"></tr></TABLE></TD>';
		 oTd.innerHTML = cv;
   }
    for(var i=0 ; i<size; i++){
	      sort.getSortSearchChi(data[i].sortId,8,function(dataCh){
		 	if(dataCh !== null)
		 	{
		 
		 		 var chSize = dataCh.length;
		 		 for(var j=0;j<chSize;j++){
		 			var soObj = document.getElementById("so_"+dataCh[j].parentSortId);
		 		    var soTd= soObj.insertCell();
		            soTd.innerHTML ='<TD noWrap="noWrap" ><A href="app/pre/search.do?sortId='+dataCh[j].sortId+'">'+dataCh[j].sortName+'</A> </TD>';
		          }
		          if(j>0)
		          {
		            var soObj = document.getElementById("so_"+dataCh[j-1].parentSortId);
		 		    var soTd= soObj.insertCell();
		            soTd.innerHTML ='<TD noWrap="noWrap" ><A href="javascript:moresort(\''+dataCh[j-1].parentSortId+'\')">更多..</A> </TD>';
		          }
		 	}
		 }
		 );
	 } 
  }); 

}

loadSort();
//-->
</script>
